package logic.startdecision;

import java.util.EmptyStackException;

import core.runner.ApplicationRunner;

public class LogicalUserDecision implements Parsable_Interface {

	private boolean decision;

	@Override
	public boolean parseData(String finalUserDecision) {
		try {
			switch(finalUserDecision){
			case "y":
				decision = true;
				break;
			case "n":
				decision = false;
				break;
			default:
				ApplicationRunner applicationRunner = new ApplicationRunner();
				applicationRunner.run();
			}
		}
		catch(EmptyStackException exception) {
			System.err.println("I'm sorry. It isn't OK. You must contact to author: astolarski@lgbs.pl. Error type: final user decision null pointer exception " + finalUserDecision);
			throw new NullPointerException();
		}
		
		finally {
			return decision;
		}
	}
	
}
